﻿function TopController($scope, service, $routeParams, $location, $http) {
    
    $scope.date = new Date();
   
    var s = "2012-10-16T17:57:28.556094Z";
    $scope.v = {
        Dt: Date.now(),
        sDt: s,
        DDt: Date.parse(s)
    }

    $scope.timeNow = moment().format('YYYY/MM/DD       HH:mm a');

    //get total of staff forget check in month
    $http.get(service.locationUrl + "/NumberForGotCheck/" + service.infoUser.Id, {})
        .success(function (data) {
            $scope.rowsTotalForGetCheck = data;
        })
        .error(function (err) {

            console.log("error", err);
        });

    //get total of staff visaEpx in month
    $http.get(service.locationUrl + "/visaexperation/" + service.infoUser.Id, {})
        .success(function (data) {
            $scope.rowsTotalVisaEpx = data;
        })
        .error(function (err) {

            console.log("error", err);
        });

    /// get data of store
    $http.get(service.locationUrl + "/staffworkatstore/" + service.infoUser.Id, {})
        .success(function (data) {
            $scope.rowsStore = data;

            $scope.sl = _.uniq($scope.rowsStore, function (e) {
                return e.StoreID;
            });
        })
        .error(function (err) {
            console.log("error", err);
        });

    ////
    $scope.getEmployee = function (StoreID) {
        return _.where($scope.rowsStore, { StoreID: StoreID });
    }
 
}

